package com.study.core.error;

import lombok.Getter;

/**
 * @Description 异常枚举，XXX可以改成自己的项目简写
 * @Author dangxianyue
 * @Date 2024/5/31 10:25
 */
@Getter
public enum XXXErrorEnum implements ErrorCodeMsg {

    UNDEFINED(-2, "未定义错误"),
    FAIL(-1, "操作失败"),
    SUCCESS(200, "操作成功"),

    DB_INSERT_FAIL(10, "插入数据库失败"),
    TOO_MANY_RESULT(11, "数据重复"),
    ALREADY_PRESENT(12, "数据已存在"),
    ABSENT(13, "数据不存在"),
    UN_SUPPORT_OPERATION(14, "暂不支持该操作:{}"),
    JWT_TOKEN_ERROR(15, "token错误或过期"),
    UN_LOGIN(16, "未登录系统"),
    DUPLICATE_KEY(17, "数据已存在"),
    FEIGN_ERROR(18, "feign请求异常"),
    TOKEN_FORCE_OFFLINE(19, "强制下线"),
    VERIFICATION_CODE_ALREADY_SEND(20, "请勿重复发送验证码"),
    BAD_SQL_GRAMMAR(21, "sql错误"),
    IO_ERROR(22, "io异常"),
    FILE_NOT_FOUND(23, "文件不存在"),
    DATASOURCE_CONNECT_FAIL(24, "数据源连接失败"),

    ACCESS_DENIED_403(403, "权限不足"),
    NOT_FOUND_404(404, "链接不存在"),
    METHOD_NOT_ALLOWED_405(405, "不支持的HTTP方法"),
    INTERNAL_SERVER_ERROR_500(500, "服务器内部错误"),

    // 用户名密码错误,
    ILLEGAL_ARGUMENT_ERROR(1002, "参数错误:{}"),

    URI_PARSE_ERROR(1003, "uri解析错误"),
    HTTP_METHOD_PARSE_ERROR(1004, "http method 解析错误"),
    VERIFICATION_CODE_ERROR(1006, "验证码错误"),
    ASSOCIATED_DATA(1007, "存在关联数据"),
    TOKEN_EXPIRED(1008, "token 已过期"),
    TOKEN_ILLEGAL(1009, "token 错误"),
    CONFIG_ERROR(1010, "配置错误"),
    DIR_NOT_FOUND(1011, "目录不存在[{}]"),
    DATE_TIME_ERROR(1012, "时间格式错误"),
    ;

    private final Integer code;
    private final String msg;

    XXXErrorEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}
